package cn.kw0501.tms.utils;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import org.springframework.util.DigestUtils;

/**
 * 名称
 *
 * @Description :
 * @Author : pq
 * @Date: 2022/8/12 21:26
 */
public class CodeUtil {

    public static String  enCode(String pwd,String salt){

        pwd = DigestUtils.md5DigestAsHex(pwd.getBytes());

        pwd+=salt;
        return DigestUtils.md5DigestAsHex(pwd.getBytes());
    }
    public static boolean checkCode(String pwd,String salt,String encodePwd){
        String enPwd = enCode(pwd,salt);
        return enPwd.equals(encodePwd);
    }
}
